﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using CsToYjk;
using RevitData;
using DataFuncApplication;

namespace ConsoleApp1
{
    class kjtest
    { 
        static void Main(string[] args)
        {
            //标准层
            Mdl_StdFlr StdFlr = DataFunc.StdFlr_Generate(3900);
            //工程参数
            Mdl_ProjectPara ProjectPara = DataFunc.ProjectPara_Set("10101");
            //截面定义
            Mdl_ColSect defcol = DataFunc.ColSect_Def(6, 1, "400,400");
            Mdl_BeamSect defbeam1 = DataFunc.BeamSect_Def(6, 1, "250,600");
            Mdl_BeamSect defbeam2 = DataFunc.BeamSect_Def(6, 1, "200,400");
            //荷载定义
            Mdl_LoadSect beamload1 = DataFunc.def_load("beam", "1.00,9.60");
            Mdl_LoadSect beamload2 = DataFunc.def_load("beam", "1.00,5.50");
            //生成节点
            var nodelist = new List<List<Mdl_Joint>>();
            var originpos = new List<int> { 0, 0 };
            var xspans = new List<int> { originpos[0], 3900, 3900, 3900, 3900, 3900, 3900 };
            var yspans = new List<int> { originpos[1], 6700, 5300 };
            nodelist = DataFunc.node_generate(xspans, yspans, StdFlr);
            //生成网格
            var gridlist = new List<Mdl_Grid>();
            gridlist = DataFunc.grid_generate(nodelist, 0, 1);
            //布置框架梁柱及荷载
            DataFunc.column_arrange(nodelist, defcol);
            var beam_list = new List<Mdl_BeamSeg>();
            beam_list= DataFunc.beam_arrange(gridlist, defbeam1);
            DataFunc.load_arrange(beam_list, beamload1);
            gridlist = DataFunc.grid_generate(nodelist, 1, 0);
            beam_list= DataFunc.beam_arrange(gridlist, defbeam2);
            DataFunc.load_arrange(beam_list, beamload2);
            //布置次梁
            xspans = new List<int> { originpos[0], 3900, 3900, 3900, 3900, 3900, 3900};
            yspans = new List<int> { 5200 };
            nodelist = DataFunc.node_generate(xspans, yspans, StdFlr);
            gridlist = DataFunc.grid_generate(nodelist, 1, 0);
            beam_list = DataFunc.beam_arrange(gridlist, defbeam2);
            DataFunc.load_arrange(beam_list, beamload2);
            //标准层复制
            DataFunc.bzc_copy(0, StdFlr, 6, 3600);
            //提交建模数据
            DataFunc.DbModel_Assign();
            Hi_AddProjectToYjk my = new Hi_AddProjectToYjk(DataFunc.model);
            bool isok=my.CreateYDB("C:\\Users\\10497\\Desktop\\ConsoleApp\\ConsoleApp1");
            if(isok) Console.WriteLine("运行完成！");
            Console.ReadLine();
        }
    }
}
